/*
 * Copyright (c) 2023-2025 elsfs Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.elsfs.cloud.common.mybatis.ext.sql;

import java.util.Arrays;
import java.util.Collection;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.elsfs.cloud.common.mybatis.ext.sql.support.builder.StandardSelectSql;
import org.elsfs.cloud.common.mybatis.ext.sql.support.common.FieldEnumResolverSupport;
import org.elsfs.cloud.common.mybatis.ext.sql.support.common.HierarchyTableAliasManager;
import org.elsfs.cloud.common.mybatis.ext.sql.support.common.SimpleTableAliasManager;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.AndConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.BetweenBeginValueConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.BetweenEndValueConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.BetweenFieldConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.BetweenValueConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.CompareOperator;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.CompositeConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.ConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.ExpressionConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.FieldConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.FieldSubQueryConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.FieldValueConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.InConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.InSubQueryConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.IsNotNullConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.IsNotNullSubQueryConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.IsNullConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.IsNullSubQueryConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.LikeConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.LikeType;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.NotBetweenBeginValueConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.NotBetweenEndValueConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.NotBetweenFieldConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.NotBetweenValueConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.NotInConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.NotInSubQueryConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.NotLikeConditionItem;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.OrConditionItem;

/**
 * 抽象条件实现
 *
 * @param <C> 子类实现类型
 */
@SuppressWarnings("unchecked")
public abstract class AbstractCondition<C extends Condition<C>> extends CompositeSqlFragment
    implements Condition<C>, SqlParameterManagerAware, TableAliasManagerAware {

  /** 子类实现 */
  protected final C childThis = (C) this;

  /**
   * 解析字段枚举名称
   *
   * @param field 字段枚举
   * @return 字段名称
   */
  protected String resolveFieldName(Enum<?> field) {
    return FieldEnumResolverSupport.resolveFieldName(this.getTableAliasManager(), field);
  }

  /**
   * 解析字段枚举名称
   *
   * @param tableAlias 字段表别名
   * @param field 字段枚举
   * @return 字段名称
   */
  protected String resolveFieldName(String tableAlias, Enum<?> field) {
    return tableAlias + "." + field.name();
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C eq(String leftField, String rightField) {
    this.addConditionItem(
        new AndConditionItem(new FieldConditionItem(leftField, rightField, CompareOperator.EQUAL)));

    return this.childThis;
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C eq(Enum<?> leftField, Enum<?> rightField) {
    return this.eq(this.resolveFieldName(leftField), this.resolveFieldName(rightField));
  }

  /**
   * 相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C eq(
      String leftTableAlias, Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.eq(
        this.resolveFieldName(leftTableAlias, leftField),
        this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C eq(String leftTableAlias, Enum<?> leftField, Enum<?> rightField) {
    return this.eq(
        this.resolveFieldName(leftTableAlias, leftField), this.resolveFieldName(rightField));
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C eq(Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.eq(
        this.resolveFieldName(leftField), this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C eq(String leftField, Enum<?> rightField) {
    return this.eq(leftField, this.resolveFieldName(rightField));
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段名称
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C eq(String leftField, String rightTableAlias, Enum<?> rightField) {
    return this.eq(leftField, this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C eq(Enum<?> leftField, String rightField) {
    return this.eq(this.resolveFieldName(leftField), rightField);
  }

  /**
   * 相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C eq(String leftTableAlias, Enum<?> leftField, String rightField) {
    return this.eq(this.resolveFieldName(leftTableAlias, leftField), rightField);
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段名称
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C eq(String leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new FieldSubQueryConditionItem(
                leftField, standardSelectSql.buildSqlFragment(), CompareOperator.EQUAL)));

    return this.childThis;
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C eq(Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.eq(this.resolveFieldName(leftField), sqlBuilderConsumer);
  }

  /**
   * 相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C eq(
      String leftTableAlias, Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.eq(this.resolveFieldName(leftTableAlias, leftField), sqlBuilderConsumer);
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段名称
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C eqValue(String leftField, Object rightValue) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldValueConditionItem(
                this.getSqlParameterManager(), leftField, rightValue, CompareOperator.EQUAL)));

    return this.childThis;
  }

  /**
   * 相等条件
   *
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C eqValue(Enum<?> leftField, Object rightValue) {
    return this.eqValue(this.resolveFieldName(leftField), rightValue);
  }

  /**
   * 相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C eqValue(String leftTableAlias, Enum<?> leftField, Object rightValue) {
    return this.eqValue(this.resolveFieldName(leftTableAlias, leftField), rightValue);
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C ne(String leftField, String rightField) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldConditionItem(leftField, rightField, CompareOperator.NOT_EQUAL)));

    return this.childThis;
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ne(Enum<?> leftField, Enum<?> rightField) {
    return this.ne(this.resolveFieldName(leftField), this.resolveFieldName(rightField));
  }

  /**
   * 不相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ne(
      String leftTableAlias, Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.ne(
        this.resolveFieldName(leftTableAlias, leftField),
        this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 不相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ne(String leftTableAlias, Enum<?> leftField, Enum<?> rightField) {
    return this.ne(
        this.resolveFieldName(leftTableAlias, leftField), this.resolveFieldName(rightField));
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ne(Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.ne(
        this.resolveFieldName(leftField), this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ne(String leftField, Enum<?> rightField) {
    return this.ne(leftField, this.resolveFieldName(rightField));
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段名称
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ne(String leftField, String rightTableAlias, Enum<?> rightField) {
    return this.ne(leftField, this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C ne(Enum<?> leftField, String rightField) {
    return this.ne(this.resolveFieldName(leftField), rightField);
  }

  /**
   * 不相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C ne(String leftTableAlias, Enum<?> leftField, String rightField) {
    return this.ne(this.resolveFieldName(leftTableAlias, leftField), rightField);
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段名称
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C ne(String leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new FieldSubQueryConditionItem(
                leftField, standardSelectSql.buildSqlFragment(), CompareOperator.NOT_EQUAL)));

    return this.childThis;
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C ne(Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.ne(this.resolveFieldName(leftField), sqlBuilderConsumer);
  }

  /**
   * 不相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C ne(
      String leftTableAlias, Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.ne(this.resolveFieldName(leftTableAlias, leftField), sqlBuilderConsumer);
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段名称
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C neValue(String leftField, Object rightValue) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldValueConditionItem(
                this.getSqlParameterManager(), leftField, rightValue, CompareOperator.NOT_EQUAL)));

    return this.childThis;
  }

  /**
   * 不相等条件
   *
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C neValue(Enum<?> leftField, Object rightValue) {
    return this.neValue(this.resolveFieldName(leftField), rightValue);
  }

  /**
   * 不相等条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C neValue(String leftTableAlias, Enum<?> leftField, Object rightValue) {
    return this.neValue(this.resolveFieldName(leftTableAlias, leftField), rightValue);
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C lt(String leftField, String rightField) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldConditionItem(leftField, rightField, CompareOperator.LESS_THAN)));

    return this.childThis;
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C lt(Enum<?> leftField, Enum<?> rightField) {
    return this.lt(this.resolveFieldName(leftField), this.resolveFieldName(rightField));
  }

  /**
   * 小于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C lt(
      String leftTableAlias, Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.lt(
        this.resolveFieldName(leftTableAlias, leftField),
        this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 小于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C lt(String leftTableAlias, Enum<?> leftField, Enum<?> rightField) {
    return this.lt(
        this.resolveFieldName(leftTableAlias, leftField), this.resolveFieldName(rightField));
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C lt(Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.lt(
        this.resolveFieldName(leftField), this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C lt(String leftField, Enum<?> rightField) {
    return this.lt(leftField, this.resolveFieldName(rightField));
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段名称
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C lt(String leftField, String rightTableAlias, Enum<?> rightField) {
    return this.lt(leftField, this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C lt(Enum<?> leftField, String rightField) {
    return this.lt(this.resolveFieldName(leftField), rightField);
  }

  /**
   * 小于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C lt(String leftTableAlias, Enum<?> leftField, String rightField) {
    return this.lt(this.resolveFieldName(leftTableAlias, leftField), rightField);
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段名称
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C lt(String leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new FieldSubQueryConditionItem(
                leftField, standardSelectSql.buildSqlFragment(), CompareOperator.LESS_THAN)));

    return this.childThis;
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C lt(Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.lt(this.resolveFieldName(leftField), sqlBuilderConsumer);
  }

  /**
   * 小于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C lt(
      String leftTableAlias, Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.lt(this.resolveFieldName(leftTableAlias, leftField), sqlBuilderConsumer);
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段名称
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C ltValue(String leftField, Object rightValue) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldValueConditionItem(
                this.getSqlParameterManager(), leftField, rightValue, CompareOperator.LESS_THAN)));

    return this.childThis;
  }

  /**
   * 小于条件
   *
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C ltValue(Enum<?> leftField, Object rightValue) {
    return this.ltValue(this.resolveFieldName(leftField), rightValue);
  }

  /**
   * 小于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C ltValue(String leftTableAlias, Enum<?> leftField, Object rightValue) {
    return this.ltValue(this.resolveFieldName(leftTableAlias, leftField), rightValue);
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C le(String leftField, String rightField) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldConditionItem(leftField, rightField, CompareOperator.LESS_THAN_OR_EQUAL)));

    return this.childThis;
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C le(Enum<?> leftField, Enum<?> rightField) {
    return this.le(this.resolveFieldName(leftField), this.resolveFieldName(rightField));
  }

  /**
   * 小于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C le(
      String leftTableAlias, Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.le(
        this.resolveFieldName(leftTableAlias, leftField),
        this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 小于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C le(String leftTableAlias, Enum<?> leftField, Enum<?> rightField) {
    return this.le(
        this.resolveFieldName(leftTableAlias, leftField), this.resolveFieldName(rightField));
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C le(Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.le(
        this.resolveFieldName(leftField), this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C le(String leftField, Enum<?> rightField) {
    return this.le(leftField, this.resolveFieldName(rightField));
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段名称
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C le(String leftField, String rightTableAlias, Enum<?> rightField) {
    return this.le(leftField, this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C le(Enum<?> leftField, String rightField) {
    return this.le(this.resolveFieldName(leftField), rightField);
  }

  /**
   * 小于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C le(String leftTableAlias, Enum<?> leftField, String rightField) {
    return this.le(this.resolveFieldName(leftTableAlias, leftField), rightField);
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段名称
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C le(String leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new FieldSubQueryConditionItem(
                leftField,
                standardSelectSql.buildSqlFragment(),
                CompareOperator.LESS_THAN_OR_EQUAL)));

    return this.childThis;
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C le(Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.le(this.resolveFieldName(leftField), sqlBuilderConsumer);
  }

  /**
   * 小于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C le(
      String leftTableAlias, Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.le(this.resolveFieldName(leftTableAlias, leftField), sqlBuilderConsumer);
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段名称
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C leValue(String leftField, Object rightValue) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldValueConditionItem(
                this.getSqlParameterManager(),
                leftField,
                rightValue,
                CompareOperator.LESS_THAN_OR_EQUAL)));

    return this.childThis;
  }

  /**
   * 小于等于条件
   *
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C leValue(Enum<?> leftField, Object rightValue) {
    return this.leValue(this.resolveFieldName(leftField), rightValue);
  }

  /**
   * 小于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C leValue(String leftTableAlias, Enum<?> leftField, Object rightValue) {
    return this.leValue(this.resolveFieldName(leftTableAlias, leftField), rightValue);
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C gt(String leftField, String rightField) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldConditionItem(leftField, rightField, CompareOperator.GREATER_THAN)));

    return this.childThis;
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C gt(Enum<?> leftField, Enum<?> rightField) {
    return this.gt(this.resolveFieldName(leftField), this.resolveFieldName(rightField));
  }

  /**
   * 大于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C gt(
      String leftTableAlias, Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.gt(
        this.resolveFieldName(leftTableAlias, leftField),
        this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 大于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C gt(String leftTableAlias, Enum<?> leftField, Enum<?> rightField) {
    return this.gt(
        this.resolveFieldName(leftTableAlias, leftField), this.resolveFieldName(rightField));
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C gt(Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.gt(
        this.resolveFieldName(leftField), this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C gt(String leftField, Enum<?> rightField) {
    return this.gt(leftField, this.resolveFieldName(rightField));
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段名称
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C gt(String leftField, String rightTableAlias, Enum<?> rightField) {
    return this.gt(leftField, this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C gt(Enum<?> leftField, String rightField) {
    return this.gt(this.resolveFieldName(leftField), rightField);
  }

  /**
   * 大于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C gt(String leftTableAlias, Enum<?> leftField, String rightField) {
    return this.gt(this.resolveFieldName(leftTableAlias, leftField), rightField);
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段名称
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C gt(String leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new FieldSubQueryConditionItem(
                leftField, standardSelectSql.buildSqlFragment(), CompareOperator.GREATER_THAN)));

    return this.childThis;
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C gt(Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.gt(this.resolveFieldName(leftField), sqlBuilderConsumer);
  }

  /**
   * 大于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C gt(
      String leftTableAlias, Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.gt(this.resolveFieldName(leftTableAlias, leftField), sqlBuilderConsumer);
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段名称
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C gtValue(String leftField, Object rightValue) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldValueConditionItem(
                this.getSqlParameterManager(),
                leftField,
                rightValue,
                CompareOperator.GREATER_THAN)));

    return this.childThis;
  }

  /**
   * 大于条件
   *
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C gtValue(Enum<?> leftField, Object rightValue) {
    return this.gtValue(this.resolveFieldName(leftField), rightValue);
  }

  /**
   * 大于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C gtValue(String leftTableAlias, Enum<?> leftField, Object rightValue) {
    return this.gtValue(this.resolveFieldName(leftTableAlias, leftField), rightValue);
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C ge(String leftField, String rightField) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldConditionItem(leftField, rightField, CompareOperator.GREATER_THAN_OR_EQUAL)));

    return this.childThis;
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ge(Enum<?> leftField, Enum<?> rightField) {
    return this.ge(this.resolveFieldName(leftField), this.resolveFieldName(rightField));
  }

  /**
   * 大于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ge(
      String leftTableAlias, Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.ge(
        this.resolveFieldName(leftTableAlias, leftField),
        this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 大于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ge(String leftTableAlias, Enum<?> leftField, Enum<?> rightField) {
    return this.ge(
        this.resolveFieldName(leftTableAlias, leftField), this.resolveFieldName(rightField));
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段枚举
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ge(Enum<?> leftField, String rightTableAlias, Enum<?> rightField) {
    return this.ge(
        this.resolveFieldName(leftField), this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段名称
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ge(String leftField, Enum<?> rightField) {
    return this.ge(leftField, this.resolveFieldName(rightField));
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段名称
   * @param rightTableAlias 右边字段表别名
   * @param rightField 右边字段枚举
   * @return 具体实现
   */
  @Override
  public C ge(String leftField, String rightTableAlias, Enum<?> rightField) {
    return this.ge(leftField, this.resolveFieldName(rightTableAlias, rightField));
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C ge(Enum<?> leftField, String rightField) {
    return this.ge(this.resolveFieldName(leftField), rightField);
  }

  /**
   * 大于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightField 右边字段名称
   * @return 具体实现
   */
  @Override
  public C ge(String leftTableAlias, Enum<?> leftField, String rightField) {
    return this.ge(this.resolveFieldName(leftTableAlias, leftField), rightField);
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段名称
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C ge(String leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new FieldSubQueryConditionItem(
                leftField,
                standardSelectSql.buildSqlFragment(),
                CompareOperator.GREATER_THAN_OR_EQUAL)));

    return this.childThis;
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C ge(Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.ge(this.resolveFieldName(leftField), sqlBuilderConsumer);
  }

  /**
   * 大于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C ge(
      String leftTableAlias, Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.ge(this.resolveFieldName(leftTableAlias, leftField), sqlBuilderConsumer);
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段名称
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C geValue(String leftField, Object rightValue) {
    this.addConditionItem(
        new AndConditionItem(
            new FieldValueConditionItem(
                this.getSqlParameterManager(),
                leftField,
                rightValue,
                CompareOperator.GREATER_THAN_OR_EQUAL)));

    return this.childThis;
  }

  /**
   * 大于等于条件
   *
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C geValue(Enum<?> leftField, Object rightValue) {
    return this.geValue(this.resolveFieldName(leftField), rightValue);
  }

  /**
   * 大于等于条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValue 右边值
   * @return 具体实现
   */
  @Override
  public C geValue(String leftTableAlias, Enum<?> leftField, Object rightValue) {
    return this.geValue(this.resolveFieldName(leftTableAlias, leftField), rightValue);
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段名称
   * @param endField 区间结束字段名称
   * @return 具体实现
   */
  @Override
  public C between(String leftField, String beginField, String endField) {
    this.addConditionItem(
        new AndConditionItem(new BetweenFieldConditionItem(leftField, beginField, endField)));

    return this.childThis;
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段枚举
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C between(String leftField, Enum<?> beginField, Enum<?> endField) {
    return this.between(
        leftField, this.resolveFieldName(beginField), this.resolveFieldName(endField));
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段名称
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C between(String leftField, String beginField, Enum<?> endField) {
    return this.between(leftField, beginField, this.resolveFieldName(endField));
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段枚举
   * @param endField 区间结束字段名称
   * @return 具体实现
   */
  @Override
  public C between(String leftField, Enum<?> beginField, String endField) {
    return this.between(leftField, this.resolveFieldName(beginField), endField);
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginField 区间开始字段枚举
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C between(Enum<?> leftField, Enum<?> beginField, Enum<?> endField) {
    return this.between(
        this.resolveFieldName(leftField),
        this.resolveFieldName(beginField),
        this.resolveFieldName(endField));
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginField 区间开始字段
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C between(Enum<?> leftField, String beginField, Enum<?> endField) {
    return this.between(
        this.resolveFieldName(leftField), beginField, this.resolveFieldName(endField));
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginField 区间开始字段枚举
   * @param endField 区间结束字段
   * @return 具体实现
   */
  @Override
  public C between(Enum<?> leftField, Enum<?> beginField, String endField) {
    return this.between(
        this.resolveFieldName(leftField), this.resolveFieldName(beginField), endField);
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段名称
   * @param beginValue 区间开始值
   * @param endField 区间结束字段名称
   * @return 具体实现
   */
  @Override
  public C betweenBeginValue(String leftField, Object beginValue, String endField) {
    this.addConditionItem(
        new AndConditionItem(
            new BetweenBeginValueConditionItem(
                this.getSqlParameterManager(), leftField, beginValue, endField)));

    return this.childThis;
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginValue 区间开始值
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C betweenBeginValue(Enum<?> leftField, Object beginValue, Enum<?> endField) {
    return this.betweenBeginValue(
        this.resolveFieldName(leftField), beginValue, this.resolveFieldName(endField));
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段名称
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C betweenEndValue(String leftField, String beginField, Object endValue) {
    this.addConditionItem(
        new AndConditionItem(
            new BetweenEndValueConditionItem(
                this.getSqlParameterManager(), leftField, beginField, endValue)));

    return this.childThis;
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginField 区间开始字段枚举
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C betweenEndValue(Enum<?> leftField, Enum<?> beginField, Object endValue) {
    return this.betweenEndValue(
        this.resolveFieldName(leftField), this.resolveFieldName(beginField), endValue);
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段名称
   * @param beginValue 区间开始值
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C betweenValue(String leftField, Object beginValue, Object endValue) {
    this.addConditionItem(
        new AndConditionItem(
            new BetweenValueConditionItem(
                this.getSqlParameterManager(), leftField, beginValue, endValue)));

    return this.childThis;
  }

  /**
   * 区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginValue 区间开始值
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C betweenValue(Enum<?> leftField, Object beginValue, Object endValue) {
    return this.betweenValue(this.resolveFieldName(leftField), beginValue, endValue);
  }

  /**
   * 区间条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param beginValue 区间开始值
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C betweenValue(
      String leftTableAlias, Enum<?> leftField, Object beginValue, Object endValue) {
    return this.betweenValue(
        this.resolveFieldName(leftTableAlias, leftField), beginValue, endValue);
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段名称
   * @param endField 区间结束字段名称
   * @return 具体实现
   */
  @Override
  public C notBetween(String leftField, String beginField, String endField) {
    this.addConditionItem(
        new AndConditionItem(new NotBetweenFieldConditionItem(leftField, beginField, endField)));

    return this.childThis;
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段枚举
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C notBetween(String leftField, Enum<?> beginField, Enum<?> endField) {
    return this.notBetween(
        leftField, this.resolveFieldName(beginField), this.resolveFieldName(endField));
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段名称
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C notBetween(String leftField, String beginField, Enum<?> endField) {
    return this.notBetween(leftField, beginField, this.resolveFieldName(endField));
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段枚举
   * @param endField 区间结束字段名称
   * @return 具体实现
   */
  @Override
  public C notBetween(String leftField, Enum<?> beginField, String endField) {
    return this.notBetween(leftField, this.resolveFieldName(beginField), endField);
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginField 区间开始字段枚举
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C notBetween(Enum<?> leftField, Enum<?> beginField, Enum<?> endField) {
    return this.notBetween(
        this.resolveFieldName(leftField),
        this.resolveFieldName(beginField),
        this.resolveFieldName(endField));
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginField 区间开始字段
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C notBetween(Enum<?> leftField, String beginField, Enum<?> endField) {
    return this.notBetween(
        this.resolveFieldName(leftField), beginField, this.resolveFieldName(endField));
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginField 区间开始字段枚举
   * @param endField 区间结束字段
   * @return 具体实现
   */
  @Override
  public C notBetween(Enum<?> leftField, Enum<?> beginField, String endField) {
    return this.notBetween(
        this.resolveFieldName(leftField), this.resolveFieldName(beginField), endField);
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段名称
   * @param beginValue 区间开始值
   * @param endField 区间结束字段名称
   * @return 具体实现
   */
  @Override
  public C notBetweenBeginValue(String leftField, Object beginValue, String endField) {
    this.addConditionItem(
        new AndConditionItem(
            new NotBetweenBeginValueConditionItem(
                this.getSqlParameterManager(), leftField, beginValue, endField)));

    return this.childThis;
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginValue 区间开始值
   * @param endField 区间结束字段枚举
   * @return 具体实现
   */
  @Override
  public C notBetweenBeginValue(Enum<?> leftField, Object beginValue, Enum<?> endField) {
    return this.notBetweenBeginValue(
        this.resolveFieldName(leftField), beginValue, this.resolveFieldName(endField));
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段名称
   * @param beginField 区间开始字段名称
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C notBetweenEndValue(String leftField, String beginField, Object endValue) {
    this.addConditionItem(
        new AndConditionItem(
            new NotBetweenEndValueConditionItem(
                this.getSqlParameterManager(), leftField, beginField, endValue)));

    return this.childThis;
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginField 区间开始字段枚举
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C notBetweenEndValue(Enum<?> leftField, Enum<?> beginField, Object endValue) {
    return this.notBetweenEndValue(
        this.resolveFieldName(leftField), this.resolveFieldName(beginField), endValue);
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段名称
   * @param beginValue 区间开始值
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C notBetweenValue(String leftField, Object beginValue, Object endValue) {
    this.addConditionItem(
        new AndConditionItem(
            new NotBetweenValueConditionItem(
                this.getSqlParameterManager(), leftField, beginValue, endValue)));

    return this.childThis;
  }

  /**
   * 非区间条件
   *
   * @param leftField 左边字段枚举
   * @param beginValue 区间开始值
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C notBetweenValue(Enum<?> leftField, Object beginValue, Object endValue) {
    return this.notBetweenValue(this.resolveFieldName(leftField), beginValue, endValue);
  }

  /**
   * 非区间条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param beginValue 区间开始值
   * @param endValue 区间结束值
   * @return 具体实现
   */
  @Override
  public C notBetweenValue(
      String leftTableAlias, Enum<?> leftField, Object beginValue, Object endValue) {
    return this.notBetweenValue(
        this.resolveFieldName(leftTableAlias, leftField), beginValue, endValue);
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段名称
   * @param rightFields 范围字段名称
   * @return 具体实现
   */
  @Override
  public C in(String leftField, String... rightFields) {
    this.addConditionItem(
        new AndConditionItem(
            new InConditionItem(
                this.getSqlParameterManager(), leftField, Arrays.asList(rightFields), null)));

    return this.childThis;
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightFields 范围字段枚举
   * @return 具体实现
   */
  @Override
  public C in(Enum<?> leftField, Enum<?>... rightFields) {
    return this.in(
        this.resolveFieldName(leftField),
        Arrays.stream(rightFields).map(this::resolveFieldName).toArray(String[]::new));
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段名称
   * @param rightFields 范围字段名称
   * @return 具体实现
   */
  @Override
  public C in(String leftField, Collection<String> rightFields) {
    this.addConditionItem(
        new AndConditionItem(
            new InConditionItem(this.getSqlParameterManager(), leftField, rightFields, null)));

    return this.childThis;
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightFields 范围字段枚举
   * @return 具体实现
   */
  @Override
  public C in(Enum<?> leftField, Collection<Enum<?>> rightFields) {
    return this.in(
        this.resolveFieldName(leftField),
        rightFields.stream().map(this::resolveFieldName).collect(Collectors.toSet()));
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段名称
   * @param rightFields 范围字段名称
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C in(String leftField, Collection<String> rightFields, Collection<?> rightValues) {
    this.addConditionItem(
        new AndConditionItem(
            new InConditionItem(
                this.getSqlParameterManager(), leftField, rightFields, rightValues)));

    return this.childThis;
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightFields 范围字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C in(Enum<?> leftField, Collection<Enum<?>> rightFields, Collection<?> rightValues) {
    return this.in(
        this.resolveFieldName(leftField),
        rightFields.stream().map(this::resolveFieldName).collect(Collectors.toSet()),
        rightValues);
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段名称
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C in(String leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new InSubQueryConditionItem(leftField, standardSelectSql.buildSqlFragment())));

    return this.childThis;
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C in(Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.in(this.resolveFieldName(leftField), sqlBuilderConsumer);
  }

  /**
   * 范围条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C in(
      String leftTableAlias, Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.in(this.resolveFieldName(leftTableAlias, leftField), sqlBuilderConsumer);
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段名称
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C inValue(String leftField, Object... rightValues) {
    this.addConditionItem(
        new AndConditionItem(
            new InConditionItem(
                this.getSqlParameterManager(), leftField, null, Arrays.asList(rightValues))));

    return this.childThis;
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C inValue(Enum<?> leftField, Object... rightValues) {
    return this.inValue(this.resolveFieldName(leftField), rightValues);
  }

  /**
   * 范围条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C inValue(String leftTableAlias, Enum<?> leftField, Object... rightValues) {
    return this.inValue(this.resolveFieldName(leftTableAlias, leftField), rightValues);
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段名称
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C inValue(String leftField, Collection<?> rightValues) {
    this.addConditionItem(
        new AndConditionItem(
            new InConditionItem(this.getSqlParameterManager(), leftField, null, rightValues)));

    return this.childThis;
  }

  /**
   * 范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C inValue(Enum<?> leftField, Collection<?> rightValues) {
    return this.inValue(this.resolveFieldName(leftField), rightValues);
  }

  /**
   * 范围条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C inValue(String leftTableAlias, Enum<?> leftField, Collection<?> rightValues) {
    return this.inValue(this.resolveFieldName(leftTableAlias, leftField), rightValues);
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段名称
   * @param rightFields 范围字段名称
   * @return 具体实现
   */
  @Override
  public C notIn(String leftField, String... rightFields) {
    this.addConditionItem(
        new AndConditionItem(
            new NotInConditionItem(
                this.getSqlParameterManager(), leftField, Arrays.asList(rightFields), null)));

    return this.childThis;
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightFields 范围字段枚举
   * @return 具体实现
   */
  @Override
  public C notIn(Enum<?> leftField, Enum<?>... rightFields) {
    return this.notIn(
        this.resolveFieldName(leftField),
        Arrays.stream(rightFields).map(this::resolveFieldName).toArray(String[]::new));
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段名称
   * @param rightFields 范围字段名称
   * @return 具体实现
   */
  @Override
  public C notIn(String leftField, Collection<String> rightFields) {
    this.addConditionItem(
        new AndConditionItem(
            new NotInConditionItem(this.getSqlParameterManager(), leftField, rightFields, null)));

    return this.childThis;
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightFields 范围字段枚举
   * @return 具体实现
   */
  @Override
  public C notIn(Enum<?> leftField, Collection<Enum<?>> rightFields) {
    return this.notIn(
        this.resolveFieldName(leftField),
        rightFields.stream().map(this::resolveFieldName).collect(Collectors.toSet()));
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段名称
   * @param rightFields 范围字段名称
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C notIn(String leftField, Collection<String> rightFields, Collection<?> rightValues) {
    this.addConditionItem(
        new AndConditionItem(
            new NotInConditionItem(
                this.getSqlParameterManager(), leftField, rightFields, rightValues)));

    return this.childThis;
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightFields 范围字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C notIn(Enum<?> leftField, Collection<Enum<?>> rightFields, Collection<?> rightValues) {
    return this.notIn(
        this.resolveFieldName(leftField),
        rightFields.stream().map(this::resolveFieldName).collect(Collectors.toSet()),
        rightValues);
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段名称
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C notIn(String leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new NotInSubQueryConditionItem(leftField, standardSelectSql.buildSqlFragment())));

    return this.childThis;
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C notIn(Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.notIn(this.resolveFieldName(leftField), sqlBuilderConsumer);
  }

  /**
   * 非范围条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C notIn(
      String leftTableAlias, Enum<?> leftField, Consumer<StandardSelectSql> sqlBuilderConsumer) {
    return this.notIn(this.resolveFieldName(leftTableAlias, leftField), sqlBuilderConsumer);
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段名称
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C notInValue(String leftField, Object... rightValues) {
    this.addConditionItem(
        new AndConditionItem(
            new NotInConditionItem(
                this.getSqlParameterManager(), leftField, null, Arrays.asList(rightValues))));

    return this.childThis;
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C notInValue(Enum<?> leftField, Object... rightValues) {
    return this.notInValue(this.resolveFieldName(leftField), rightValues);
  }

  /**
   * 非范围条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C notInValue(String leftTableAlias, Enum<?> leftField, Object... rightValues) {
    return this.notInValue(this.resolveFieldName(leftTableAlias, leftField), rightValues);
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段名称
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C notInValue(String leftField, Collection<?> rightValues) {
    this.addConditionItem(
        new AndConditionItem(
            new NotInConditionItem(this.getSqlParameterManager(), leftField, null, rightValues)));

    return this.childThis;
  }

  /**
   * 非范围条件
   *
   * @param leftField 左边字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C notInValue(Enum<?> leftField, Collection<?> rightValues) {
    return this.notInValue(this.resolveFieldName(leftField), rightValues);
  }

  /**
   * 非范围条件
   *
   * @param leftTableAlias 左边字段表别名
   * @param leftField 左边字段枚举
   * @param rightValues 范围值
   * @return 具体实现
   */
  @Override
  public C notInValue(String leftTableAlias, Enum<?> leftField, Collection<?> rightValues) {
    return this.notInValue(this.resolveFieldName(leftTableAlias, leftField), rightValues);
  }

  /**
   * 为空条件
   *
   * @param field 字段名称
   * @return 具体实现
   */
  @Override
  public C isNull(String field) {
    this.addConditionItem(new AndConditionItem(new IsNullConditionItem(field)));

    return this.childThis;
  }

  /**
   * 为空条件
   *
   * @param field 字段枚举
   * @return 具体实现
   */
  @Override
  public C isNull(Enum<?> field) {
    return this.isNull(this.resolveFieldName(field));
  }

  /**
   * 为空条件
   *
   * @param tableAlias 字段表别名
   * @param field 字段枚举
   * @return 具体实现
   */
  @Override
  public C isNull(String tableAlias, Enum<?> field) {
    return this.isNull(this.resolveFieldName(tableAlias, field));
  }

  /**
   * 为空条件
   *
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C isNull(Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new IsNullSubQueryConditionItem(standardSelectSql.buildSqlFragment())));

    return this.childThis;
  }

  /**
   * 非空条件
   *
   * @param field 字段名称
   * @return 具体实现
   */
  @Override
  public C isNotNull(String field) {
    this.addConditionItem(new AndConditionItem(new IsNotNullConditionItem(field)));

    return this.childThis;
  }

  /**
   * 非空条件
   *
   * @param field 字段枚举
   * @return 具体实现
   */
  @Override
  public C isNotNull(Enum<?> field) {
    return this.isNotNull(this.resolveFieldName(field));
  }

  /**
   * 非空条件
   *
   * @param tableAlias 字段表别名
   * @param field 字段枚举
   * @return 具体实现
   */
  @Override
  public C isNotNull(String tableAlias, Enum<?> field) {
    return this.isNotNull(this.resolveFieldName(tableAlias, field));
  }

  /**
   * 非空条件
   *
   * @param sqlBuilderConsumer SQL构建器消费器
   * @return 具体实现
   */
  @Override
  public C isNotNull(Consumer<StandardSelectSql> sqlBuilderConsumer) {
    StandardSelectSql standardSelectSql =
        new StandardSelectSql(
            this.getSqlParameterManager(),
            new HierarchyTableAliasManager(
                new SimpleTableAliasManager(), this.getTableAliasManager()));
    sqlBuilderConsumer.accept(standardSelectSql);
    this.addConditionItem(
        new AndConditionItem(
            new IsNotNullSubQueryConditionItem(standardSelectSql.buildSqlFragment())));

    return this.childThis;
  }

  /**
   * 模糊匹配条件
   *
   * @param field 字段名称
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C like(String field, String value) {
    this.addConditionItem(
        new AndConditionItem(
            new LikeConditionItem(this.getSqlParameterManager(), LikeType.LIKE, field, value)));

    return this.childThis;
  }

  /**
   * 模糊匹配条件
   *
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C like(Enum<?> field, String value) {
    return this.like(this.resolveFieldName(field), value);
  }

  /**
   * 模糊匹配条件
   *
   * @param tableAlias 字段表别名
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C like(String tableAlias, Enum<?> field, String value) {
    return this.like(this.resolveFieldName(tableAlias, field), value);
  }

  /**
   * 左模糊匹配条件
   *
   * @param field 字段名称
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C likeLeft(String field, String value) {
    this.addConditionItem(
        new AndConditionItem(
            new LikeConditionItem(
                this.getSqlParameterManager(), LikeType.LIKE_LEFT, field, value)));

    return this.childThis;
  }

  /**
   * 左模糊匹配条件
   *
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C likeLeft(Enum<?> field, String value) {
    return this.likeLeft(this.resolveFieldName(field), value);
  }

  /**
   * 左模糊匹配条件
   *
   * @param tableAlias 字段表别名
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C likeLeft(String tableAlias, Enum<?> field, String value) {
    return this.likeLeft(this.resolveFieldName(tableAlias, field), value);
  }

  /**
   * 右模糊匹配条件
   *
   * @param field 字段名称
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C likeRight(String field, String value) {
    this.addConditionItem(
        new AndConditionItem(
            new LikeConditionItem(
                this.getSqlParameterManager(), LikeType.LIKE_RIGHT, field, value)));

    return this.childThis;
  }

  /**
   * 右模糊匹配条件
   *
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C likeRight(Enum<?> field, String value) {
    return this.likeRight(this.resolveFieldName(field), value);
  }

  /**
   * 右模糊匹配条件
   *
   * @param tableAlias 字段表别名
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C likeRight(String tableAlias, Enum<?> field, String value) {
    return this.likeRight(this.resolveFieldName(tableAlias, field), value);
  }

  /**
   * 非模糊匹配条件
   *
   * @param field 字段名称
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C notLike(String field, String value) {
    this.addConditionItem(
        new AndConditionItem(
            new NotLikeConditionItem(this.getSqlParameterManager(), LikeType.LIKE, field, value)));

    return this.childThis;
  }

  /**
   * 非模糊匹配条件
   *
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C notLike(Enum<?> field, String value) {
    return this.notLike(this.resolveFieldName(field), value);
  }

  /**
   * 非模糊匹配条件
   *
   * @param tableAlias 字段表别名
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C notLike(String tableAlias, Enum<?> field, String value) {
    return this.notLike(this.resolveFieldName(tableAlias, field), value);
  }

  /**
   * 非左模糊匹配条件
   *
   * @param field 字段名称
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C notLikeLeft(String field, String value) {
    this.addConditionItem(
        new AndConditionItem(
            new NotLikeConditionItem(
                this.getSqlParameterManager(), LikeType.LIKE_LEFT, field, value)));

    return this.childThis;
  }

  /**
   * 非左模糊匹配条件
   *
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C notLikeLeft(Enum<?> field, String value) {
    return this.notLikeLeft(this.resolveFieldName(field), value);
  }

  /**
   * 非左模糊匹配条件
   *
   * @param tableAlias 字段表别名
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C notLikeLeft(String tableAlias, Enum<?> field, String value) {
    return this.notLikeLeft(this.resolveFieldName(tableAlias, field), value);
  }

  /**
   * 非右模糊匹配条件
   *
   * @param field 字段名称
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C notLikeRight(String field, String value) {
    this.addConditionItem(
        new AndConditionItem(
            new NotLikeConditionItem(
                this.getSqlParameterManager(), LikeType.LIKE_RIGHT, field, value)));

    return this.childThis;
  }

  /**
   * 非右模糊匹配条件
   *
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C notLikeRight(Enum<?> field, String value) {
    return this.notLikeRight(this.resolveFieldName(field), value);
  }

  /**
   * 非右模糊匹配条件
   *
   * @param tableAlias 字段表别名
   * @param field 字段枚举
   * @param value 匹配值
   * @return 具体实现
   */
  @Override
  public C notLikeRight(String tableAlias, Enum<?> field, String value) {
    return this.notLikeRight(this.resolveFieldName(tableAlias, field), value);
  }

  /**
   * 表达式匹配条件
   *
   * @param expression 表达式
   * @param args 表达式参数
   * @return 具体实现
   */
  @Override
  public C expression(String expression, Object... args) {
    this.addConditionItem(new AndConditionItem(new ExpressionConditionItem(expression, args)));

    return this.childThis;
  }

  /**
   * 嵌套条件
   *
   * @return 条件嵌套器
   */
  @Override
  public AbstractNestCondition<C> nest() {
    NestConditionImpl nestCondition = new NestConditionImpl();
    this.addConditionItem(
        new AndConditionItem(new CompositeConditionItem(nestCondition.getConditionItems())));

    return nestCondition;
  }

  /**
   * 开始或条件
   *
   * @return 或条件构建器
   */
  @Override
  public AbstractOrCondition<C> or() {
    OrConditionImpl orCondition = new OrConditionImpl();
    this.addConditionItem(
        new OrConditionItem(new CompositeConditionItem(orCondition.getConditionItems())));

    return orCondition;
  }

  /**
   * 添加一个条件
   *
   * @param conditionItem 条件
   */
  protected abstract void addConditionItem(ConditionItem conditionItem);

  /**
   * 获取SQL参数管理器
   *
   * @return SQL参数管理器
   */
  @Override
  public SqlParameterManager getSqlParameterManager() {
    return null;
  }

  /**
   * 获取表别名管理器
   *
   * @return 表名别管理器
   */
  @Override
  public TableAliasManager getTableAliasManager() {
    return null;
  }

  /** 嵌套条件构建实现 */
  class NestConditionImpl extends AbstractNestCondition<C> {

    /**
     * 结束嵌套条件
     *
     * @return 上级对象
     */
    @Override
    public C endNest() {
      return AbstractCondition.this.childThis;
    }

    /**
     * 获取SQL参数管理器
     *
     * @return SQL参数管理器
     */
    @Override
    public SqlParameterManager getSqlParameterManager() {
      return AbstractCondition.this.getSqlParameterManager();
    }

    /**
     * 获取表别名管理器
     *
     * @return 表名别管理器
     */
    @Override
    public TableAliasManager getTableAliasManager() {
      return AbstractCondition.this.getTableAliasManager();
    }
  }

  /** Or条件构建实现 */
  class OrConditionImpl extends AbstractOrCondition<C> {

    /**
     * 结束或条件
     *
     * @return 上级对象
     */
    @Override
    public C endOr() {
      return AbstractCondition.this.childThis;
    }

    /**
     * 获取SQL参数管理器
     *
     * @return SQL参数管理器
     */
    @Override
    public SqlParameterManager getSqlParameterManager() {
      return AbstractCondition.this.getSqlParameterManager();
    }

    /**
     * 获取表别名管理器
     *
     * @return 表名别管理器
     */
    @Override
    public TableAliasManager getTableAliasManager() {
      return AbstractCondition.this.getTableAliasManager();
    }
  }
}
